<template>
	<view class="mingxi">
		<view style="display: flex;justify-content: flex-end;margin-bottom: 10px;">
			<view class="head_btn" @tap="jump_cash">去提现</view>
		</view>
		<None v-if="list_empty"></None>
		<view v-else class="ticheng">
			<block v-for="(item, index) of list" :key="index">
				<li class="tc">
					<view class="tc_l">
						<!-- <span>代理提成-{{ item.card.bank_num.substr(item.card.bank_num.length - 4) }}</span> -->
						<span>代理提成-{{ item.money }}</span>
						<br />
						{{ item.rewardTime }}
					</view>
					<view class="tc_2">
						+{{ item.money }}
						<br />
						<span v-if="item.status == 0">提现中</span>
						<span v-if="item.status == 1">已完成</span>
					</view>
				</li>
			</block>
		</view>
	</view>
</template>

<script>
	import {
		mapActions
	} from 'vuex';
	import None from '@/components/qy/none.vue';
	import uniIcon from '@/components/uni/uni-icon/uni-icon.vue';
	export default {
		data() {
			return {
				list: [],
				list_empty: false
			};
		},
		onLoad() {
			this.getRewardList();
		},
		onShareAppMessage(res) {
			let referrer = uni.getStorageSync('referrer');
			console.log('referrer', referrer);
			if (referrer) {
				return {
					title: '恒鲜惠美食在线',
					path: '/pages/menu/menu?referrer=' + referrer,
					imageUrl: require('static/images/menu/banner.jpeg')
				}
			}
		},
		components: {
			uniIcon,
			None
		},
		methods: {
			...mapActions(['rewardList']),
			getRewardList() {
				uni.showLoading({
					mask: true
				});
				this.rewardList().then(res => {
					if (!res.data.length) {
						this.list_empty = true;
					}
					this.list = res.data || [];
					uni.hideLoading();
					uni.stopPullDownRefresh();
				}).catch(err => {
					uni.stopPullDownRefresh();
				});
			},
			jump_cash() {
				uni.navigateTo({
					url: '/pages/user/cash/cash'
				});
			}
		},
		onPullDownRefresh() {
			this.getRewardList();
		}
	};
</script>

<style lang="less">
	.mingxi {
		.head {
			display: flex;
			margin: 10px 0;
		}

		.head_l {
			display: flex;
			width: 85%;
			justify-content: space-around;
		}

		.head_r {
			width: 15%;
			text-align: center;
		}

		.head_l_1 {
			border: 1px solid #f2f2f2;
			padding: 0px 15px;
			line-height: 25px;
		}

		.head_btn {
			margin: 10px 20px 0;
			border: 1px solid #f2f2f2;
			padding: 0px 15px;
			line-height: 25px;
		}

		.ling {
			color: #e1461d;
			border: 1px solid #e1461d;
			padding: 0px 15px;
			line-height: 25px;
		}

		.shouyi {
			border-top: 1px solid #ebebeb;
			border-bottom: 1px solid #ebebeb;
			background-color: #fafafa;
			display: flex;
			height: 30px;
			line-height: 30px;
			padding: 3px 10px;
			margin-top: 15px;
		}

		.sy_l {
			width: 50%;
		}

		.sy_l span {
			font-weight: bold;
		}

		.ticheng li:nth-of-type(odd) {
			background-color: #eeeeee;
		}

		.ticheng li:nth-of-type(even) {
			background-color: #fff;
		}

		.tc {
			display: flex;
			justify-content: space-between;
			padding: 10px;
			line-height: 25px;
			font-size: 14px;
		}

		.tc_l {
			color: #9a9a9a;
		}

		.tc_l span {
			font-size: 14px;
			font-weight: bold;
			color: #000;
		}

		.tc_2 {
			color: #e1461d;
		}

		.tc_2 span {
			color: #9a9a9a;
		}
	}
</style>
